package org.wu.framework.authorization.platform.infrastructure.converter;

import org.wu.framework.authorization.platform.infrastructure.entity.SysDictionaryDataDO;
import org.wu.framework.authorization.platform.domain.model.sys.dictionary.data.SysDictionaryData;
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyInfrastructureConverter;

/**
 * describe
 *
 * @author Jia wei Wu
 * @date 2023/05/17 11:19 晚上
 * @see DefaultDDDLazyInfrastructureConverter
 **/

public class SysDictionaryDataConverter {


    /**
     * describe 实体对象 转换成领域对象
     *
     * @param
     * @return
     * @exception/throws
     * @author Jia wei Wu
     * @date 2023/05/17 11:19 晚上
     **/
    public static SysDictionaryData toDictionaryData(SysDictionaryDataDO sysDictionaryDataDO) {
        if (null != sysDictionaryDataDO) {
            SysDictionaryData sysDictionaryData = new SysDictionaryData();
            sysDictionaryData.setCode(sysDictionaryDataDO.getCode());
            sysDictionaryData.setCreateTime(sysDictionaryDataDO.getCreateTime());
            sysDictionaryData.setDescription(sysDictionaryDataDO.getDescription());
            sysDictionaryData.setDictionaryCode(sysDictionaryDataDO.getDictionaryCode());
            sysDictionaryData.setId(sysDictionaryDataDO.getId());
            sysDictionaryData.setName(sysDictionaryDataDO.getName());
            sysDictionaryData.setPcode(sysDictionaryDataDO.getPcode());
            sysDictionaryData.setSortValue(sysDictionaryDataDO.getSortValue());
            sysDictionaryData.setUpdateTime(sysDictionaryDataDO.getUpdateTime());
            return sysDictionaryData;
        }
        return null;
    }

    /**
     * describe 领域对象 转换成实体对象
     *
     * @param
     * @return
     * @exception/throws
     * @author Jia wei Wu
     * @date 2023/05/17 11:19 晚上
     **/
    public static SysDictionaryDataDO fromDictionaryData(SysDictionaryData sysDictionaryData) {
        if (null != sysDictionaryData) {
            SysDictionaryDataDO sysDictionaryDataDO = new SysDictionaryDataDO();
            sysDictionaryDataDO.setCode(sysDictionaryData.getCode());
            sysDictionaryDataDO.setCreateTime(sysDictionaryData.getCreateTime());
            sysDictionaryDataDO.setDescription(sysDictionaryData.getDescription());
            sysDictionaryDataDO.setDictionaryCode(sysDictionaryData.getDictionaryCode());
            sysDictionaryDataDO.setId(sysDictionaryData.getId());
            sysDictionaryDataDO.setName(sysDictionaryData.getName());
            sysDictionaryDataDO.setPcode(sysDictionaryData.getPcode());
            sysDictionaryDataDO.setSortValue(sysDictionaryData.getSortValue());
            sysDictionaryDataDO.setUpdateTime(sysDictionaryData.getUpdateTime());
            return sysDictionaryDataDO;
        }
        return null;
    }

}